package com.fyl.configuration;

import com.fyl.filter.UserFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 冯永龙
 * @date 2020/12/3 9:45
 */
@Configuration
public class FilterConfiguration {

    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new UserFilter());
        filterRegistrationBean.addUrlPatterns("/cart/*");         //过滤前缀带有cart的路径
        filterRegistrationBean.addUrlPatterns("/orders/*");
        filterRegistrationBean.addUrlPatterns("/userInfo.html");
        return filterRegistrationBean;
    }
}
